import { S } from '../../s';
import { IPSControlHandlerAction } from '../ipscontrol-handler-action';
import { IPSAjaxControlHandler } from './ipsajax-control-handler';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAjaxControlHandlerImpl
  extends PSModelObjectImpl
  implements IPSAjaxControlHandler
{
  get cacheScope(): 0 | 1 | 2 | 3 | 4 {
    return this.M.cacheScope != null ? this.M.cacheScope : 0;
  }

  get cacheTimeout(): number {
    return this.M.cacheTimeout != null ? this.M.cacheTimeout : -1;
  }

  get handlerTag(): string {
    return this.M.handlerTag;
  }

  get handlerTag2(): string {
    return this.M.handlerTag2;
  }

  protected pshandleractions: IPSControlHandlerAction[];
  getPSHandlerActions(): IPSControlHandlerAction[] | null {
    return (
      this.pshandleractions ||
      (this.pshandleractions = this.fillChildListModel(
        this.M.getPSHandlerActions,
        S._93,
      ) as IPSControlHandlerAction[])
    );
  }

  findPSControlHandlerAction(objKey: any): IPSControlHandlerAction | null {
    return this.getPSModel5(
      S._93,
      this.getPSHandlerActions(),
      objKey,
    ) as IPSControlHandlerAction;
  }

  get uniStateField(): string {
    return this.M.uniStateField;
  }

  get uniStateKeyValue(): string {
    return this.M.uniStateKeyValue;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get enableCache(): boolean {
    return this.M.enableCache != null ? this.M.enableCache : false;
  }

  get enableDEFieldPrivilege(): boolean {
    return this.M.enableDEFieldPrivilege;
  }
  get cls(): string {
    return 'PSAjaxControlHandlerImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._95 || cls == S._96) return true;
    return super.instanceof(cls);
  }
}
